package com.ebuy.shopping.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ebuy.shopping.mapper.ShopMapper;
import com.ebuy.shopping.model.Shop;

@Service
/**
 * 
 * @ClassName: ShopService 
 * @Description: TODO 
 * @author wenzhao 
 * @date 2017年8月10日 上午10:25:44 
 *
 */
public class ShopService implements IShopService
{
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public Shop load(int id) throws Exception
    {
        return shopMapper.selectByPrimaryKey(id);

    }

    @Override
    public List<Shop> getShops() throws Exception
    {
        return shopMapper.selectShops();

    }

    @Override
    public int add(Shop s) throws Exception
    {
        return shopMapper.insert(s);

    }

    @Override
    public int update(Shop s) throws Exception
    {
        return shopMapper.updateByPrimaryKey(s);

    }

    @Override
    public List<Shop> getShopsByUser(String userId)
    {

        return shopMapper.getShopsByUser(userId);

    }
}
